import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path"

import AutoImport from 'unplugin-auto-import/vite'
import AutoComponents from 'unplugin-vue-components/vite'
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'

// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    alias: {
      "@/": path.resolve(__dirname, "./assets"),
    },
  },
  plugins: [
    vue(),
    AutoComponents({
      dirs: ["asset/components"],
      dts: 'assets/component-auto-imports.d.ts'
    }),
    AutoImport({
      imports: ["vue", "vue-router", "vue-i18n", "@vueuse/core", "@vueuse/head"],
      dts: './assets/auto-imports.d.ts',
      vueTemplate: true
    }),
    VueI18nPlugin({
      /* options */
      // include 指定语文配置文件位置
      include: [path.resolve(__dirname, 'assets/locales/**')]
    })
  ],
  build: {
    manifest: true,
    rollupOptions: {
      input: './assets/main.ts'
    }
  }
})
